package com.example.kugou.controller;

import com.example.kugou.pojo.Comment;
import com.example.kugou.service.CommentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/comment")
@Api(tags = "评论相关接口",description = "提供评论相关的Rest API")
public class CommentController {
    @Resource
    CommentService commentService;

    @ApiOperation("根据歌曲编号查询该歌曲的评论")
    @ApiImplicitParam(name = "singId",value = "歌曲id",required = true)
    @GetMapping("/getCommentBySingId")
    public Map<String,Object> getCommentBySingId(int singId){
        return commentService.getCommentBySingId(singId);
    }



    @ApiOperation("根据歌单编号查询该歌单的评论")
    @ApiImplicitParam(name = "song_sheetId",value = "歌单id",required = true)
    @GetMapping("/getCommentBySong_sheetId")
    public Map<String,Object> getCommentBySong_sheetId(int song_sheetId){
        return commentService.getCommentBySong_sheetId(song_sheetId);
    }



    @ApiOperation("新增评论接口")
    @PostMapping(value = "/insertComment",produces = "application/json;charset=UTF-8")
    public Map<String,Object> insertComment(@ApiParam(name = "comment",value = "评论",required = true)Comment comment){
        return commentService.insertComment(comment);
    }
}
